home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 003a / asmlib35.zip / SYSTEM.DOC < prev    next >
Text File  |  1993-01-21  |  24KB  |  785 lines

  1.  
  2. *****************************  SYSTEM  *************************************
  3.  
  4. ASMLIB system subroutines Copyright (C) 1991 - 1993 Douglas Herr
  5. all rights reserved
  6.  
  7.  
  8. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  9.  
  10. BREAKTRAP:   initialize Ctrl+Break trap
  11. BREAKRELEASE:restore previous Ctrl+Break handler
  12. Source:      break.asm
  13.  
  14. BREAKFLAG:   public byte in DGROUP, indicating Ctrl+Break key press
  15. Source:      asmflags.asm
  16.  
  17. Call with:   no parameters
  18.              BreakTrap uses well-behaved methods to trap Ctrl+Break,
  19.              Ctrl+C and Ctrl-Alt-Del key sequences.  When one of these
  20.              key combinations is pressed, ASMLIB's break trap sets the
  21.              public flag "breakflag" in the data area.  BreakRelease
  22.              de-activates ASMLIB's break trap, restoring the previous
  23.              Ctrl+Break handler.  BreakFlag = 0 until a monitored key
  24.              combination is pressed, at which time breakflag is set
  25.              equal to 1.  If you use BreakTrap, you MUST call BreakRelease
  26.              before the end of your program, or you will find yourself
  27.              reaching for the Big Red Switch.  See STARTUP.ASM.
  28. Returns:     nothing
  29. Uses:        nothing
  30. Example:     see STARTUP.ASM
  31.  
  32.  
  33.  
  34. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  35.  
  36. COLOR16:     calculate color value for palette register
  37. Source:      color16.asm
  38.  
  39. Call with:   DS:[BX] pointing to red value (0-3), green value (0-3)
  40.              and blue value (0-3)
  41.              Assumes DS:@data; see also Palette16
  42. Returns:     AH = color value for 16-color palette register
  43. Uses:        AH
  44. Supports:    VGA 16-color modes (text or graphics)
  45.              EGA 16-color modes, except with CGA monitor
  46. Example:
  47.  
  48. .data
  49. c16     db 3                  ; brightest red
  50.         db 1                  ; dim green
  51.         db 0                  ; no blue
  52.  
  53. .code
  54. ; program fragment assumes DS:@data
  55.         .
  56.         .
  57.         .
  58.         lea   bx,c16
  59.         call  color16
  60.  
  61.  
  62.  
  63. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  64.  
  65. DOSALLOC:    allocate memory block from unused DOS memory
  66. Source:      dosalloc.asm
  67.  
  68. Call with:   DX:AX = number of bytes to allocate
  69.              DOSAlloc uses DOS function 48h to allocate memory from free
  70.              DOS memory.  See ENDPROG and STARTUP.ASM or TINY.ASM.
  71. Returns:     if CF = 0, AX = segment address of start of memory block
  72.                              offset of start of memory block = 0
  73.              if CF = 1, insufficient DOS memory space is available.
  74. Uses:        AX, CF; all other flags and registers are saved
  75. Example:
  76.  
  77. .model huge
  78.  
  79. extrn    bitblockbytes:proc, dosalloc:proc
  80.  
  81. .code
  82. ; this example uses bitblockbytes to calculate the memory required
  83. ; to save a bit block on a graphics screen
  84.          .
  85.          .
  86.          .
  87.          lea   bx,corners      ; point to bit block corner coordinates
  88.          call  bitblockbytes   ; returns DX:AX = number of bytes required
  89.          call  dosalloc
  90.          jc    no_memory       ; do some error handling stuff
  91.  
  92.  
  93.  
  94. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  95.  
  96. ENDPROG:     determines program's size
  97.              this is handy for dynamic memory allocation, or for TSR work
  98. Source:      endprog.asm
  99.  
  100. Call with:   no parameters
  101. Returns:     (small, medium, huge models)
  102.              AX = segment address of end of program.  See STARTUP.ASM.
  103.              ENDPROG defines ZSEG as the last segment in the program.
  104.              If you add any object modules to ASMLIB.LIB, be certain any
  105.              segments in the added modules are defined before LINK
  106.              encounters ENDPROG.  Be sure to review the .MAP file after
  107.              linking.  ZSEG should be at the end of the program.
  108.              (tiny model)
  109.              AX = offset of end of the program's code and initialized data.
  110.              See TINY.ASM startup code.  If you add any object modules to
  111.              ASMTINY.LIB, be certain any segments in the added modules
  112.              are defined before LINK encounters ENDPROG, and that all
  113.              segments are grouped in DGROUP.  Be sure to review the .MAP
  114.              file after linking.  ZSEG should be at the end of the program.
  115.              With TINY model, program stack extends beyond the end of the
  116.              code and initialized data to the end of the 64k program
  117.              segment.
  118. Uses:        AX
  119. Example:     see STARTUP.ASM or TINY.ASM
  120.  
  121.  
  122. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  123.  
  124. EXENAME:     determine the full path and filename of the executing program
  125. Source:      exename.asm (strlen.asm)
  126.  
  127. Call with:   ES = PSP segment (see STARTUP.ASM)
  128. Returns:     ES:[BX] pointing to the the name of the executing program,
  129.              including drive and full path, CX = length of the filename.
  130.              The filename returned is an ASCIIZ string, and may be mixed
  131.              upper- and lower-case characters.
  132. Uses:        ES, BX, CX; all other registers and flags are saved.
  133. Example:
  134.  
  135. include asm.inc
  136.  
  137. extrn   exename:proc
  138.  
  139. .data
  140. extrn   pspseg:word
  141.  
  142. .code
  143. ; program fragment assumes DS:@data
  144.         .
  145.         .
  146.         .
  147.         mov   es,pspseg
  148.         call  exename         ; string returned at ES:[BX] can be
  149.                               ; copied to heap with STRNDUP
  150.  
  151.  
  152.  
  153. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  154.  
  155. FARALLOC:    allocate memory from a far heap
  156. Source:      farheap.asm
  157.  
  158. Call with:   ES = segment address of far heap
  159.              AX = requested block size
  160. Returns:     if CF = 1, insufficient memroy available in heap
  161.              if CF = 0, ES:[BX] = starting address of allocated memory
  162. Uses:        BX, flags
  163. Example:     see FarInit
  164.  
  165.  
  166. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  167.  
  168. FARFREE:     releases far heap memory previously allocated
  169. Source:      farheap.asm
  170.  
  171. Call with:   ES:[BX] pointing to memory block to be released
  172. Returns:     nothing
  173. Uses:        AX, BX, flags
  174. Example:     mov   es,heap_seg
  175.              mov   bx,pointer
  176.              call  farfree
  177.  
  178.  
  179. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  180.  
  181. FARINIT:     initializes a far heap
  182. Source:      farheap.asm
  183.  
  184. Call with:   ES = segment address of memory block to be managed by ASMLIB's
  185.              far heap manager
  186.              AX = size of memory block in bytes (2 < bytes < 32768)
  187.              FarInit assumes that the memory block begins at ES:[0].
  188.              Any number of far heaps may be used if memory is available.
  189. Returns:     if CF = 0, successful; if CF = 1, AX is out of range.
  190. Uses:        flags
  191. Example:
  192.  
  193. include asm.inc
  194.  
  195. extrn   dosalloc:proc, farinit:proc
  196.  
  197. .data
  198. heap_seg        dw ?
  199.  
  200. .code
  201.         .
  202.         .
  203.         .
  204.         mov     ax,32767
  205.         xor     dx,dx           ; allocate 32k from DOS memory
  206.         push    ax
  207.         call    dosalloc
  208.         mov     heap_seg,ax     ; segment address of allocated block
  209.         pop     ax              ; size of block
  210.         jc      not_enough_dos  ; insufficient memory available
  211.         mov     es,heap_seg
  212.         call    farinit         ; initialize this block
  213.         .
  214.         .
  215.         mov     ax,125          ; get 125 bytes from far heap
  216.         mov     es,heap_seg     ; heap address
  217.         call    faralloc        ; get far memory; returned at ES:[BX]
  218.         jc      not_enough_heap
  219.  
  220.  
  221.  
  222. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  223.  
  224. FARREALLOC:  re-sizes a block of memory in a far heap
  225. Source:      farheap.asm
  226.  
  227. Call with:   ES:[BX] = original pointer to memory block
  228.              AX = new byte size
  229. Returns:     if successful, CF = 0, ES:[BX] points to new block
  230.              if not successful, CF = 1
  231. Uses:        BX, flags
  232. Example:     mov    es,heap_seg
  233.              mov    bx,pointer
  234.              mov    ax,newsize
  235.              call   farrealloc
  236.  
  237.  
  238. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  239.  
  240. FINDMONO:    detects a monochrome-compatible video card
  241.              this is handy in 2-monitor systems.
  242. Source:      findmono.asm (a$herc.asm, isega.asm, find6845.asm)
  243.  
  244. Call with:   no parameters
  245. Returns:     if CF = 1, no monochrome monitor
  246.              if CF = 0, AX = monitor code
  247.               0 = MDA
  248.               0101h = EGA monochrome
  249.               0301h = VGA monochrome
  250.               128 = Hercules or clone
  251.               144 = Hercules Graphics Card plus
  252.               208 = Hercules InColor
  253. Uses:        AX, CF
  254. Supports:    MDA, EGA & VGA MONO, HGC, HGC+, InColor
  255. Example:     call  findmono
  256.              jc    no_monochrome
  257.  
  258.  
  259.  
  260. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  261.  
  262. FLOPPIES:    determine the number of floppy disk drives intalled
  263. Source:      floppies.asm
  264.  
  265. Call with:   no parameters
  266. Returns:     AX = number of floppy drives
  267. Uses:        AX; all other registers and flags are saved
  268. Example:
  269.  
  270. .model medium
  271.  
  272. public  myproc
  273. extrn   floppies:proc
  274.  
  275. .code
  276. myproc  proc
  277.         .
  278.         call   floppies
  279.  
  280.  
  281.  
  282. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  283.  
  284. FLOPPYTYPE:  determine the number of floppy disk drives intalled
  285. Source:      floptype.asm
  286.  
  287. Call with:   DL = drive number (0 = drive A:)
  288. Returns:     AX = floppy drive type
  289.               0 = invalid drive number
  290.               1 = 360k
  291.               2 = 1.2M
  292.               3 = 720k
  293.               4 = 1.44M
  294. Uses:        AX, flags
  295. Example:
  296.  
  297. .model medium
  298.  
  299. public  myproc
  300. extrn   floppytype:proc
  301.  
  302. .data
  303. drive_number   db 0
  304.  
  305. .code
  306. myproc  proc
  307.         .
  308.         mov    dl,drive_number
  309.         call   floppytype
  310.         or     ax,ax
  311.         jz     bad_drive_number
  312.  
  313. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  314.  
  315. GETCPU:      detects cpu type
  316. Source:      getcpu.asm
  317.  
  318. Call with:   no parameters
  319. Returns:     AX = 0 if 8086/8088
  320.              AX = 1 if 80186/80188
  321.              AX = 2 if 80286
  322.              AX = 3 if 386 (SX or DX)
  323.              AX = 4 if 486 (SX or DX)
  324. Uses:        AX
  325. Example:     call   getcpu
  326.  
  327.  
  328.  
  329. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  330.  
  331. GETCRT:      determines active monitor type
  332. Source:      getcrt.asm (a$herc.asm, isevga.asm)
  333.  
  334. Call with:   no parameters
  335. Returns:     AX = code for active video system
  336.              CGA = -1
  337.              MDA = 0
  338.              EGA mono = 0100h
  339.              VGA mono = 0300h
  340.              EGA color = 1
  341.              MCGA = 2
  342.              VGA color = 3
  343.              HGC = 128
  344.              HGC+ = 144
  345.              InColor = 208
  346.              Note: GetCRT may be re-assembled with the /DNOHERC switch
  347.              to eliminate code which detects Hercules equipment
  348. Uses:        AX
  349. Supports:    CGA, MCGA, MDA, HGC, HGC+, InColor, EGA, VGA
  350. Example:     call    getcrt
  351.  
  352.  
  353.  
  354. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  355.  
  356. HALLOC:      allocates memory from near heap
  357. Source:      heap.asm
  358.  
  359. Call with:   AX = bytes requested; assumes DS:@data
  360.              heap must be initialized with hinit
  361. Returns:     if space available:
  362.              BX = near pointer for allocated data
  363.              if space not available:
  364.              CF = 1
  365. Uses:        AX, BX, flags
  366. Example:     mov   ax,bytes
  367.              call  halloc
  368.              jc    no_memory       ; check to see if there was enough space
  369.  
  370.  
  371. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  372.  
  373. HFREE:       releases heap memory previously allocated
  374. Source:      heap.asm
  375.  
  376. Call with:   BX = near pointer to memory block; assumes DS:@data
  377. Returns:     nothing
  378. Uses:        flags
  379. Example:     mov   bx,pointer
  380.              call  hfree
  381.  
  382.  
  383.  
  384. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  385.  
  386. HINIT:       initializes heap manager
  387. Source:      heap.asm
  388.  
  389. Call with:   AX = number of bytes to be managed by heap manager
  390.              2 <=bytes<= 32767
  391.              BX = near pointer to memory block to be managed
  392.              assumes  DS:@data
  393. Returns:     CF = 0 if ok, CF = 1 if bad parameter (bytes too
  394.              small or too large)
  395. Uses:        flags
  396. Example:
  397.  
  398. .data
  399. heap   db  32767 dup(0)
  400.  
  401. .code
  402.        mov    ax,@data
  403.        mov    ds,ax
  404.        assume ds:@data
  405.        mov    ax,32767
  406.        lea    bx,heap
  407.        call   hinit
  408.  
  409.  
  410. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  411.  
  412. HMAX:        determines largest free block in asmlib's near heap
  413. Source:      heap.asm
  414.  
  415. Call with:   no parameters
  416. Returns:     AX = block size in bytes
  417.              AX = -1 if the heap has not been initialized
  418. Uses:        AX
  419. Example:     call   hmax
  420.  
  421.  
  422.  
  423. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  424.  
  425. HREALLOC:    re-sizes a block of memory in the near heap
  426. Source:      heap.asm
  427.  
  428. Call with:   BX = original pointer to memory block
  429.              AX = new byte size
  430. Returns:     if successful, CF = 0, BX = new block pointer
  431.              if not successful, CF = 1
  432. Uses:        BX, flags
  433. Example:     mov    bx,pointer
  434.              mov    ax,newsize
  435.              call   hrealloc
  436.  
  437.  
  438. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  439.  
  440. ISANSI:      determines if ANSI or compatible is loaded and active
  441. Source:      isansi.asm
  442.  
  443. Parameters:  none
  444. Returns:     CF = 1 if no ANSI device driver loaded and active
  445.              CF = 0 if ANSI loaded and active
  446. Uses:        CF
  447. Example:     call   isansi         ; let's see if ansi.sys is loaded
  448.              jc     no_ansi        ; jump if not
  449.  
  450.  
  451.  
  452. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  453.  
  454. ISATT:       determines if an ATT 6300-type display card is installed
  455.              this equipment is like a CGA except that it has an additional
  456.              640 x 400 2-color graphics mode (mode 40h)
  457. Source:      isatt.asm ($6845.asm, isevga.asm)
  458.  
  459. Call with:   no parameters
  460. Returns:     if CF = 1, ATT 6300 display not present
  461.              if CF = 0, ATT 6300 display is installed
  462. Uses:        flags
  463. Example:
  464.  
  465. include asm.inc
  466.  
  467. public  cgamode
  468.  
  469. extrn   isatt:proc
  470.  
  471. .code
  472. cgamode proc
  473.         mov     ax,06h             ; default: set CGA mode
  474.         call    isatt              ; see if mode 40h is available
  475.         jc      set_mode           ; nope
  476.         mov     ax,40h             ;  use ATT 6300 mode 40h
  477. set_mode:
  478.         push    bp                 ; required by old PC BIOS
  479.         int     10h                ; use BIOS to set mode
  480.         pop     bp
  481.         ret
  482. cgamode endp
  483.         end
  484.  
  485.  
  486. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  487.  
  488. ISEVGA:      determines if an EGA or VGA is installed
  489. Source:      isevga.asm
  490.  
  491. Call with:   no parameters
  492. Returns:     if CF = 1, no EGA or VGA
  493.              if CF = 0
  494.                DX = video memory in kbytes
  495.                AL = monitor type
  496.                 AL = -1 if monitor is CGA
  497.                 AL = 0 if monitor is monochrome
  498.                 AL = 1 if monitor is EGA or better
  499.  
  500.                AH = EGA/VGA flag
  501.                 AH = 1 if EGA
  502.                 AH = 3 if VGA
  503.  
  504. Uses:        AX, DX, CF
  505. Example:     call   isevga
  506.              jc     no_evga
  507.  
  508.  
  509.  
  510. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  511.  
  512. ISHERC:      determines if a Hercules card or compatible is installed
  513.              and if so, determines if it is the active video system.
  514. Source:      isherc.asm (a$herc.asm)
  515.  
  516. Call with:   no parameters
  517. Returns:     if CF = 1, no Hercules or compatible installed
  518.              if CF = 0, AX = Hercules model
  519.              128 = Hercules Graphics Card or compatible; active
  520.              144 = Hercules Graphics Card Plus; active
  521.              208 = Hercules InColor card; active
  522.              -128 = Hercules Graphics Card or compatible; not active
  523.              -144 = Hercules Graphics Card Plus; not active
  524.              -208 = Hercules InColor card; not active
  525. Uses:        AX, CF; all other flags and registers are saved
  526. Example:     call  isherc
  527.              jc    no_herc
  528.  
  529.  
  530.  
  531. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  532.  
  533. ISMOUSE:     determines if a mouse is installed
  534. Source:      ismouse.asm (asmflags.asm)
  535.  
  536. Parameters:  none
  537. Returns:     AX = number of mouse buttons
  538.              AX = 0 if no mouse or mouse driver installed
  539. Uses:        AX
  540. Example:
  541.  
  542. include  asm.inc
  543.  
  544. .code
  545.        .
  546.        .
  547.        .
  548.        call    ismouse
  549.        or      ax,ax
  550.        jz      no_mouse
  551.  
  552.  
  553.  
  554. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  555.  
  556. ISSEVGA:     determines if a Super EGA or Super VGA is installed
  557. Source:      issevga.asm
  558.  
  559. Parameters:  none
  560. Returns:     if CF = 1, no Super EGA or Super VGA recognized by ASMLIB
  561.  
  562.              if CF = 0
  563.  
  564.               if AH = 1: (Super EGA)
  565.                AL = 1 if Paradise EGA 480
  566.                AL = 2 if Everex EGA
  567.  
  568.               if AH = 3: (Super VGA)
  569.                AL = 1 if Paradise VGA
  570.                AL = 3 if Tseng VGA chipset
  571.                AL = 4 if Oak VGA
  572.                AL = 5 if Western Digital VGA chipset
  573.  
  574.              See also IsEVGA
  575. Uses:        AX, CF
  576. Example:     call   issevga
  577.              jc     no_superevga
  578.  
  579.  
  580.  
  581. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  582.  
  583. MATHCHIP:    determines if 80x87 math coprocessor is installed
  584. Source:      mathchip.asm
  585.  
  586. Parameters:  none
  587. Returns:     AX = code for 80x87 model
  588.              0 = not installed
  589.              1 = 8087
  590.              2 = 287
  591.              3 = 387 (DX or SX)
  592.              4 = 487 (486DX or 487SX)
  593.              If the coprocessor is present, it is initilaized by MathChip.
  594. Uses:        AX, all 80x87 registers
  595. Example:     call  mathchip
  596.  
  597.  
  598.  
  599. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  600.  
  601. MOUSEINIT:   initializes mouse driver if mouse present
  602. Source:      mouseini.asm
  603.  
  604. MOUSEFLAG:   public byte in DGROUP indicating mouse buttons
  605. Source:      asmflags.asm
  606.  
  607. Parameters:  assumes DS:@data
  608. Returns:     if mouse installed, ZF = 0 and AX = number of mouse buttons
  609.              also updates mouseflag
  610.              if no mouse, ZF = 1 and AX = 0
  611. Uses:        AX, flags
  612. Example:
  613.  
  614. include asm.inc
  615.  
  616. extrn   mouseinit:proc
  617.  
  618. .code
  619. ; program fragment assumes DS:@data
  620.         .
  621.         .
  622.         .
  623.         call    mouseinit
  624.         jz      no_mouse
  625.  
  626.  
  627.  
  628. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  629.  
  630. MSAVE:       save mouse state
  631. Source:      msave.asm (dosalloc.asm)
  632.  
  633. MRESTORE:    restore previously saved mouse state
  634. Source:      msave.asm (dosalloc.asm)
  635.  
  636.              MSave and MRestore are handy when you have installed a
  637.              mouse event handler and you will be using the SYSTEM command,
  638.              where some other program may reset or otherwise change the
  639.              mouse event trapping.
  640.  
  641.              MSave allocates a buffer, saves the mouse state in the
  642.              buffer, resets the mouse driver and returns the buffer address.
  643.  
  644.              MRestore restores a specified mouse state and releases the
  645.              buffer.  Both MSave and MRestore assume that you already
  646.              know there is a mouse in the system.
  647.  
  648. Call with:   MSAve: no paramerters
  649.              MRestore: AX = buffer address returned by prior MSave call
  650. Returns:     if CF = 1, AH = MS-DOS error code
  651.              if CF = 0, no error; MSave returns buffer address in AX
  652. Uses:        AX, flags
  653. Example:
  654.  
  655. include asm.inc
  656. extrn   msave:proc, mrestore:proc
  657.  
  658. .data
  659. save_mouse dw 0
  660.  
  661. .code
  662. ; program fragment assumes DS:@data
  663.         .
  664.         .
  665.         .
  666.  
  667. ; save the mouse driver state
  668. ; I've already checked to see if there's a mouse
  669.         call    msave
  670.         jc      dos_error
  671.         mov     save_mouse,ax
  672.         .
  673.         .
  674. ; some other subroutine has messed with the mouse
  675.         mov     ax,save_mouse   ; buffer address from previous MSave
  676.         call    mrestore
  677.         jc      dos_error
  678.  
  679.  
  680.  
  681. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  682.  
  683. PALETTE16:   change palette in EGA, VGA or SVGA 16-color mode
  684.              changing the palette changes the actual color associated
  685.              with a color attribute
  686. Source:      palet16.asm
  687.  
  688. Call with:   BH = color value (see Color16 in SYSTEM.DOC)
  689.              BL = color attribute to map color to (0-0Fh)
  690.              restore default palette with BH = BL = 0FFh
  691. Returns:     nothing
  692. Uses:        nothing
  693. Example:
  694.  
  695. .data
  696. c16     db 3                  ; brightest red
  697.         db 1                  ; dim green
  698.         db 0                  ; no blue
  699.  
  700. .code
  701. ; program fragment assumes DS:@data
  702.         .
  703.         .
  704.         .
  705.         lea   bx,c16
  706.         call  color16
  707.         mov   bh,ah           ; color value in BH
  708.         mov   bl,15           ; color attribute 0Fh
  709.         call  palette16
  710.  
  711.  
  712.  
  713. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  714.  
  715. SYSTEM:      execute a second copy of COMMAND.COM;  optionally runs another
  716.              program.
  717. Source:      system.asm (strlen.asm)
  718.  
  719. Parameters:  ES = PSP segment
  720.              DS:[BX] points to command tail
  721.              if DS:[BX] points to a nul byte, control is transfered
  722.              to the second copy of COMMAND.COM and you get a DOS prompt.
  723.              control is passed back to the calling program when EXIT is
  724.              entered at the DOS prompt.
  725.  
  726.              if DS:[BX] points to an ASCIIZ string with the name of a
  727.              program (and optional command line parameters), the program
  728.              will be executed, and control will pass back to the calling
  729.              program at the termination of the second program.
  730. Returns:     nothing
  731. Uses:        AX
  732. Example:
  733.  
  734. include asm.inc
  735.  
  736. ; I want to go to DOS temporarily to format a 720k disk
  737. extrn   system:proc
  738.  
  739. .data
  740. ; PSP segment is saved here by my startup code
  741. pspseg  dw ?
  742. cmdtail db 'format a: /n:9 /t:80',0
  743.  
  744. .code
  745. ; program fragment assumes DS:@data
  746.         .
  747.         .
  748.         lea     bx,cmdtail    ; DS:[BX] points to command tail
  749.         mov     es,pspseg
  750.         call    system
  751.  
  752.  
  753. ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  754.  
  755. USE32K:      limit Hercules equipment to 32k memory (128k on InColor)
  756. USE64K:      allow full 64k on HGC and HGC+ (256k on InColor)
  757. Source:      a$herc.asm
  758.  
  759. Requires Hercules or compatible
  760.  
  761. Call with:   no parameters
  762.              Use32k is equivalent to the Hercules "half" configuration
  763.              Use64k is equivalent to the Hercules "full" configuration
  764.              ASMLIB's default is "half".  Use this configuration if you
  765.              have a 2-monitor system, unless you are using the Hercules
  766.              CGA card. 
  767. Returns:     nothing
  768. Uses:        nothing
  769. Example:     ; in this example I'm determining if a Hercules is installed
  770.              ; and setting the configuration to "full"
  771. extrn  IsHerc:proc
  772. extrn  Use64k:proc
  773. .code
  774.        .
  775.        .
  776.        .
  777.        call  IsHerc
  778.        jc    no_herc
  779.        or    ax,ax
  780.        js    use_only_half   ; use_only_half if HGC is not default monitor
  781.        call  use64k          ; else use all Hercules memory
  782. use_only_half:
  783.  
  784.  
  785.